package com.kai.service.enums;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.experimental.FieldDefaults;

@Getter
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@FieldDefaults(level = AccessLevel.PRIVATE)
public enum GenderEnum {

    UNKNOWN(0,"未知"),
    MALE(1,"男"),
    WOMAN(2,"女");

    int code;


    String description;


    public static String getDescByCode(Integer code){
        if(null == code){
            return "未知";
        }
        GenderEnum[] values = GenderEnum.values();
        for(GenderEnum value : values){
            if(value.code == code){
                return value.description;
            }
        }
        return "未知";
    }
}
